<template lang="pug">
    skin(@up="up",@down="down",@yes="yes",@back="back",@duringUp="up",@duringDown="down")
        div(class="flex-column h2")
            div(class="flex-column-item")
            div(class="flex-column-item center")
                span 按ACT键开始 
                plan-icon(:plan="plan")
                i(class="")
            div(class="flex-column-item center")
                span 方案 按ESC返回
            div(class="flex-column-item")
</template>

<script>
export default {
    data(){
        return { 
            plan: ''
         }
    },
    methods:{
        up(){
        },
        down(){
        },
        yes(){
          this.setWindowRate();
          this.$router.push('/');
        },
        back(){
          this.$router.back()
        },
    setWindowRate() {
        
      const plan = this.$route.query.plan;
      switch (plan) {
        case "A":
         window.rate.basicRate =  window.rate.planA;
         window.rate.planUsing = 'A'
          break;
        case "B":
         window.rate.basicRate =  window.rate.planB;
         window.rate.planUsing = 'B'
          break;
        case "C":
         window.rate.basicRate =  window.rate.planC;
         window.rate.planUsing = 'C'
          break;
        default:
         window.rate.basicRate =  window.rate.planC;
         window.rate.planUsing = 'C'
         
      }

        window.rate.records.push(
          Object.assign(
            {
              type: window.advance.medicalCat.value,
              createTime: new Date()
            },
            this.basicRate
          )
        );

      this.$router.push(`/base-rate/plan?index=${plan}`);
    }
    },
    created(){
        this.plan = this.$route.query.plan
    }
}
</script>

<style>

</style>
